﻿/******************************************************************************
 *  作者：       Maxzhang1985
 *  创建时间：   2012/4/12 14:50:51
 *
 *
 ******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using ExtendPropertyLib.WPF;
using Tk=Telerik.Windows.Controls;

namespace ExORMDesginer.RadWindow.Helper
{
    public static class RadWindowViewModelHelper
    {
        public static void TryOK(this ViewModelBase viewModel)
        {
            var elem = viewModel.View as FrameworkElement;

            if (elem != null)
            {

                Tk.RadWindow window = null;

                window = elem.Parent as Tk.RadWindow;
                window.DialogResult = true;
                window.Close();
            }
        }

        public static void TryCancel(this ViewModelBase viewModel)
        {
            var elem = viewModel.View as FrameworkElement;

            if (elem != null)
            {

                Tk.RadWindow window = null;

                window = elem.Parent as Tk.RadWindow;
                window.DialogResult = false;
                window.Close();
            }
        }

    }
}
